package com.link.wseller.controller;

import com.link.wseller.from.OrderForm;
import com.link.wseller.http.JsonResult;
import com.link.wseller.serive.impl.OrderMasterServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 买家端
 */
@RestController
@RequestMapping("/buyer/order")
@Slf4j
public class BuyerOrderController {

    @Autowired
    private OrderMasterServiceImpl orderMasterService;

    @PostMapping("create")
    public JsonResult createOrder(@Valid OrderForm orderForm,
                                  BindingResult bindingResult){
        if (bindingResult.hasErrors()){
            log.error("【创建订单】参数有误: {}", orderForm);
            return JsonResult.error("参数有误");
        }
        return JsonResult.success();
    }
}
